# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-07-06
# @File : 1_header_complete.py

import time
import uuid
import requests
from hashlib import md5

# 请求头：version
version = "tgou_Android_V2.7.10.1"

# 请求头：key
data_string = f"{version}miyue"
key = md5(data_string)

# 请求头：tags_uuid
tgs_uuid = str(uuid.uuid4())

# 时间戳
timestamp = int(time.time() * 1000)

res = requests.post(
    url="mServ.51tiangou.com",
    # data=...,
    headers={
        "User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; Pixel 2 XL Build/QQ3A.200805.001)@tiangou/android/20221101/{}".format(
            timestamp),
        "version": version,
        "tgVersion": "@tiangou/android/20221101/{}".format(timestamp),
        "mid_version": "8",
        "mid_global": "android",
        "key": key,
        "tgs_uuid": tgs_uuid,
        "Host": "mServ.51tiangou.com",
    }
)
